'use strict';
module.exports = app => {
  const { STRING, INTEGER, TEXT,DECIMAL } = app.Sequelize;
    const GifSendItem = app.model.define(
      'giftSendItem',
      {
          id: {type: INTEGER, primaryKey: true, autoIncrement: true},
          gift_id: INTEGER(11),
          gift_send_id: INTEGER(11),
          name: STRING(255),
          start_time: STRING(255),
          end_time: STRING(255),
          member_id: INTEGER(11),
          is_get: INTEGER(11),
          is_use: INTEGER(11),
          code: STRING(255),
      },
      {
          tableName: 'gift_send_item',
          timestamps: true, // 启用时间戳(createdAt, updatedAt)
          updatedAt: 'updated_time', // 不想要 updatedAt
          createdAt: 'create_time', // 想要  createdAt 但是希望名称叫做 created_at
      }
  );
    GifSendItem.associate = function () {
        GifSendItem.belongsTo(app.model.Gift, { foreignKey: 'gift_id', targetKey: 'id' })
        GifSendItem.belongsTo(app.model.Member, { foreignKey: 'member_id', targetKey: 'id' })
    }
    return GifSendItem
};
